Source for file UserRights.php
Documentation is available at UserRights.php
<?php require_once 'index.php'; ?>
$currentUser = $admin->searchUsers ();
if (empty ($currentUser)) {
echo 'Run the <b>User</b> test first<br />';
$currentRight = $admin->perm ->getRights ();
if (empty ($currentRight)) {
echo 'Run the <b>Right</b> test first<br />';
$users = $admin->searchUsers ();
$rights = $admin->perm ->getRights ();
for ($i = 1; $i < 30; $i++ ) {
'perm_user_id' => $users[$randUser]['perm_user_id'],
'right_id' => $rights[$randRight]['right_id'],
$granted = $admin->perm ->grantUserRight ($data);
if ($granted === false ) {
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
echo '<b>' . $users[$randUser]['name'] . '</b> was granted the right <b>' . $rights[$randRight]['right_id'] . '</b><br />';
unset ($rights[$randRight]);
'perm_user_id' => $users[$randUser]['auth_user_id'],
'right_id' => $rights[$randRight]['right_id']
$revoked = $admin->perm ->revokeUserRight ($filters);
if ($revoked === false ) {
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
echo 'The right <b>' . $rights[$randRight]['right_id'] . '</b> has been revoked from <b>' . $users[$randUser]['name'] . '</b><br />';
'perm_user_id' => $users[$randUser]['perm_user_id']
$user_rights = $admin->perm ->getRights ($params);
if ($user_rights === false ) {
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
'perm_user_id' => $users[$randUser]['auth_user_id'],
'right_id' => $user_rights[$randRight]['right_id']
$data = array ('right_level' => 3 );
$update = $admin->perm ->updateUserRight ($data, $filters);
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
echo 'The right <b>' . $user_rights[$randRight]['right_id'] . '</b> has been updated to Level 3 for <b>' . $users[$randUser]['name'] . '</b><br />';
'right_id' => $user_rights[$randRight]['right_id'],
'perm_user_id' => $users[$randUser]['perm_user_id']
$result = $admin->perm ->getRights ($params);
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
Var_Dump ::display ($result);
'perm_user_id' => $users[$randUser]['perm_user_id']
$singleRight = $admin->perm ->getRights ($params);
if ($singleRight === false ) {
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
echo 'These are the user rights for <b>' . $users[$randUser]['name'] . '</b>:<br />';
Var_Dump ::display ($singleRight);
$allRights = $admin->perm ->getRights ($params);
if ($allRights === false ) {
echo '<strong>Error on line: '.__LINE__. ' last query: '. $admin->perm ->_storage ->dbc ->last_query. '</strong><br />';
echo 'Here are all the rights:<br />';
Var_Dump ::display ($allRights);
Documentation generated on Mon, 11 Mar 2019 14:00:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|